using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;


public class BtnSleep : MonoBehaviour
{
    // Start is called before the first frame update

    public void change_state()
    {
        gameObject.SetActive(!gameObject.activeInHierarchy);
    }

    private Button btn;
    
    void Start()
    {
        btn = gameObject.GetComponent<Button>();
        BdPackage.BdUtils.assert(btn != null);
    }

    public void btn_sleep(float t = 2f)
    {
        btn.interactable = false;
        DOTween.To(() => t, (x) => t = x, 0, t).OnComplete(
            () =>
            {
                btn.interactable = true;
            }
        );
    }
}
